package mya.mes.mdc.internal.ui;

import mya.common.jaxrs.op.OpGet;
import mya.common.jaxrs.result.ListResult;
import mya.mes.mdc.model.system.RegularReminders;
import org.apache.commons.lang3.StringUtils;

import javax.ws.rs.*;

/**
 * Created by Administrator on 2020/11/27.
 */
@Path("/{tenantId}/{loginId}/mdcalarm/ui/")
public class RegularRemindersUi {

    @PathParam("tenantId")
    private String tenantId;

    @PathParam("loginId")
    private Long loginId;

    @GET
    @Path("queryRegularRemind/")
    @Produces({"application/json"})
    public ListResult queryRegularRemind(
            @QueryParam("q") String qParam,
            @QueryParam("filter") final String filterParam,
            @QueryParam("sort") final String sortParam,
            @QueryParam("start") final Integer start,
            @QueryParam("limit") final Integer limit) {
        OpGet opGet = new OpGet(tenantId, loginId);
        String filter = "";
        if(StringUtils.isNotBlank(filterParam)){
            filter = filterParam.replace("endDate","alarmDate");
        }
        return opGet.result(RegularReminders.class.getSimpleName(), qParam, filter, sortParam, start, limit);
    }
}
